<?php

//require('../phpMQTT.php');


use utils\phpMQTT;

$server = '47.109.21.194';     // change if necessary
$port = 1883;                     // change if necessary
$username = 'admin';                   // set your username
$password = 'ca427e97733574268337c5275ca9ec30';                   // set your password
$client_id = '863482061663676'; // make sure this is unique for connecting to sever - you could use uniqid()

$mqtt = new phpMQTT($server, $port, $client_id);

if ($mqtt->connect(true, NULL, $username, $password)) {
    $mqtt->publish('863482061663676', 'Hello World! at ' . date('r'), 0, false);
    $mqtt->close();
} else {
    echo "Time out!\n";
}
